package com.hyl.pojo;

import lombok.Data;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.Map;

/**
 * @Description TODO
 * @Author hyl
 * @Date 2023/4/26 9:56
 **/
@Data
@Component("userinfo") //<bean id="userinfo" class="com.hyl.pojo.User"/>
public class User {

	private Logger logger = Logger.getLogger(User.class);

	private String username;
	private String pwd;
	private Integer age;
	private String email;
	private String desc;
	private String[] loves;
	private Map maps;

	@Autowired //按类型 <property name="role" ref="role"/>
	@Qualifier("role")
	private Role role;

	public void show(){
		logger.info("显示前。。。。");
		System.out.println("姓名："+username+",爱好："+ Arrays.toString(loves));
		System.out.println("角色:"+role.getRoleName());
		logger.info("显示后。。。。。");
	}

	public User(){}

	public User(String username){
		this.username = username;
	}

	public User(String username, String pwd, Integer age, String email) {
		this.username = username;
		this.pwd = pwd;
		this.age = age;
		this.email = email;
	}
}
